package com.ithema.b2b.userprovider.controller;

import com.ithema.b2b.userprovider.dao.UserDao;
import com.netflix.discovery.converters.Auto;
import model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserDao userDao;

    @GetMapping(value = "/register")
    public int register(@RequestParam(value = "upassword")String upassword,
                        @RequestParam(value = "uname")String uname,
                        @RequestParam(value = "usex")String usex) {
        return userDao.register(upassword, uname, usex);
    }

    @GetMapping(value = "login")
    public User login(@RequestParam(value = "uname")String uname) {
        return userDao.login(uname);
    }
}
